<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script>
        // 根据位置返回字符
        // 1. charAt(index) 根据索引号返回字符
        let str = "abcdef";
        console.log(str.charAt(1));

        // 2. charCodeAt(index)  返回相应索引号的字符 ASCII 值 目的： 判断用户按下了那个键
        console.log(str.charCodeAt(0));

        // 3. str[index] H5 新增的
        console.log(str[0]);
    </script>
</head>

<body>
    
</body>

</html>